package com.jiawa.wiki.controller;

import com.jiawa.wiki.domain.Demo;
import com.jiawa.wiki.service.DemoService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
public class DemoController {
    @Autowired
    private DemoService demoService;

//    @Value("${demo.hello:TEST}")
//    private String demoHello;
//
//    @RequestMapping(value = "/hello",method = RequestMethod.GET)
//    public String hello(){
//        return "Hello World"+demoHello;
//    }
//
//    @PostMapping(value = "/hello/post")
//    public String hellopost(String name){
//        return "Hello World! Post,"+name;
//    }

    @RequestMapping( "/demo/list")
    public List<Demo> list(String name){
        return demoService.findAll();
    }
}
